# See: https://hub.docker.com/_/php/
FROM php:7.0.13-fpm
MAINTAINER oldzhuang <zql_0539@163.com>

# redis ext
ENV PHPREDIS_VERSION 3.0.0
RUN curl -L -o /tmp/redis.tar.gz https://github.com/phpredis/phpredis/archive/${PHPREDIS_VERSION}.tar.gz \
    && tar xzf /tmp/redis.tar.gz -C /tmp \
    && mkdir -p /usr/src/php/ext \
    && mv /tmp/phpredis-$PHPREDIS_VERSION /usr/src/php/ext/redis \
    && echo 'redis' >> /usr/src/php-available-exts \
    && docker-php-ext-install redis \
    && rm -rf /usr/src/php/ext/redis

## yaf ext
ENV YAF_VERSION 3.0.4
RUN curl -L -o /tmp/yaf.tar.gz https://github.com/laruence/yaf/archive/yaf-${YAF_VERSION}.tar.gz \
    && tar xzf /tmp/yaf.tar.gz -C /tmp \
    && mkdir -p /usr/src/php/ext \
    && mv /tmp/yaf-yaf-$YAF_VERSION /usr/src/php/ext/yaf \
    && echo 'yaf' >> /usr/src/php-available-exts \
    && docker-php-ext-install yaf \
    && rm -rf /usr/src/php/ext/yaf

# install php extensions
RUN apt-get update && apt-get install -y \
        libfreetype6-dev \
        libjpeg62-turbo-dev \
        libmcrypt-dev \
        libpng12-dev \
    && docker-php-ext-install -j$(nproc) iconv mcrypt \
    && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
    && docker-php-ext-install -j$(nproc) gd mysqli pdo_mysql zip opcache
